<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<div id="app">
	</div>

	<!-- <script src="https://cdn.bootcss.com/jquery/1.7.2/jquery.min.js"></script> -->
	<script type="text/javascript">
		// 函数的作用域 scope = AO + [[scope]]

		// 高内聚 弱耦合
		
		/*function test(){
			document.write('a');
			document.write('b');
			document.write('c');
		}
		test();*/

		/*function test(){
			document.write('hello word');
		}*/

		/*var test = function abc(){
			document.write('a');
		};*/

		/*var test = function(){
			document.write('b');
		}*/

		// 形式参数 --形参
		/*function test(a,b){
			var c = a + b;
			document.write(c);
		}
		// 实际参数 -- 实参
		test(1,2);*/

		/*function sum(){
			// arguments --实参列表
			var result = 0;
			for(var i = 0; i < arguments.length; i++){
				result += arguments[i];
			};
			console.log(result);
			// return
		};
		sum(11,2,3);*/

		// return  -- 结束函数语句，并返回值
		/*function myNumber(str){
			return str;
			// console.log('b');
		};
		var myNumber = myNumber('123');*/


		// 判断动物的叫声
		/*function scream(animal){
			switch (animal) {
				case "dog":
					console.log('wang!!');
					break;
				case "cat":
					console.log('miao!!');
					break;
				case "fish":
					console.log('o`o`o');
					break;
			}
		}*/

		// 数字反转并以汉字输出
		/*function reverse(){
			var num = window.prompt('input');
			var str = "";
			for(var i = num.length -1; i >= 0; i--){
				str += transter(num[i]);
			}
			console.log(str);
		}
		function transter(target){
			switch(target){
				case "1" :
					return "壹";
				case "2" :
					return "俩";
				case "3" :
					return "叁";
			}
		}*/

		// 计算字符串长度
		/*function retByteslen(target){
			var count,
				len;
				count = len = target.length;
			for(var i = 0; i < len; i++){
				if(target.charCodeAt(i) > 255){
					count ++;
				};
			}
			console.log(count);
		}*/

		// 实现n的阶层
		/*function jc(n){
			if(n==1){
				return 1;
			}
			return n * jc(n-1);
		}*/

		var x = 1;
		if(function f(){}){
			x += typeof f;
		}
		console.log(x);


	</script>
</body>
</html>